Error in mtcars %>% summarize(mean_mpg = mean(mpg), sd_mpg = sd(mpg)): could not find function "%>%"
STA6235: Modeling in Regression
Today, we will discuss R programming in broad strokes.
It is, unfortunately, impossible for me to teach you everything you need to know about R.
My goal is to give you the building blocks and build your confidence.
Today’s lecture is taken from the following:
R for Data Science by Wickham, Çetinkaya-Rundel, and Grolemund
Statistical Inference via Data Science: A ModernDive into R and the Tidyverse by Ismay and Kim
There are lots of resources out there on R!
My process: Google the thing I want to do with either “R” or “tidyverse”
Posit cheatsheets (free!) are also helpful.
There are many functions that live in “base R”
If we want to use other functions, we need to call in the package they’re stored in
I most often get data in .csv or .xlsx format
read_csv() from readrread_xlsx() from readxlWhen sharing with other people, I’ve found Google Sheets are easy
read_sheet() from googlesheets4gsheet2tbl() from gsheetOccasionally I get data for a specific analysis program
read_sas() from havenread_spss() from havenread_dta() from havensummarize() function to request a tibble of summary statistics.group_by() function to request summary statistics by group(s).group_by() function to request summary statistics by group(s).summarize() function to request a tibble of summary statistics.… Da Bomb Beyond Insanity is always the 8th sauce …
… but it doesn’t appear much hotter than the previous sauces …
Some reminders:
Statistician/biostatistician/data scientist first, programmer second.
Yes, I will challenge you on labs and projects.
Do not be afraid to Google!
Similarly, do not be afraid to ask me to verify what you find.
Always remember that I want you to learn, which includes learning how to function within your career.
Next lecture, we will remind ourselves about linear regression and how to construct models in R.
Pull your private repos for Weeks 1 and 2.
Answer questions in this week’s Quarto document.
Push your changes back to GitHub.